package com.codeoss.framework.pagebean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.codeoss.framework.context.YunContext;
import com.codeoss.framework.data.store.ITableStore;
import com.codeoss.framework.report.query.IQueryDefStore;
import com.codeoss.framework.view.component.Message;
import com.codeoss.framework.view.component.store.IComponentStore;
import com.codeoss.framework.view.pagebean.ActionPageBean;
import com.codeoss.framework.workflow.store.IWorkflowStore;

@Service("cacheResetActionPageBean")
public class CacheResetActionPageBean extends ActionPageBean {
	@Autowired
	private IComponentStore componentStore;
	@Autowired
	private IWorkflowStore workflowStore;
	@Autowired
	private ITableStore tableStore;
	@Autowired
	private IQueryDefStore queryDefStore;
	public void resetAllCache() {
		YunContext yunContext = YunContext.getCurrentContext();
		tableStore.clear();
		workflowStore.clear();
		componentStore.clear();
		queryDefStore.clear();
		yunContext.addMessage(new Message("清除完成"));
	}
	

	public void resetTableCache() {
		YunContext yunContext = YunContext.getCurrentContext();
		tableStore.clear();
		yunContext.addMessage(new Message("模型清除完成"));
	}

	public void resetPageCache() {
		YunContext yunContext = YunContext.getCurrentContext();
		componentStore.clear();
		yunContext.addMessage(new Message("页面清除完成"));
	}

	public void resetWorkflowCache() {
		YunContext yunContext = YunContext.getCurrentContext();
		workflowStore.clear();
		yunContext.addMessage(new Message("工作流清除完成"));
	}
}
